import { showMsg } from '../../vuex/action'
export default {
  name: 'pages',
  props: ['pages', 'getList'],
  computed: {
    current() {
      return this.pages.start / this.pages.limit
    }
  },
  vuex: {
    actions: {
      xShowMsg: showMsg
    }
  },
  methods: {
    toPage(page) {
      if (page < 0 || page >= this.pages.totalPages) {
        return
      }
      this.pages.start = page * this.pages.limit
      this.getList({
        start: this.pages.start,
        limit: this.pages.limit
      })
    }
  }
}
